import yagmail, XTestRunner, time, glob



class Tools():

    def Report(self):
        t = time.strftime('%Y%m%d%H%M%S', time.localtime())
        html_file = rf'D:\zhuangaoliu\gaowei611zk_UI\Report\{t}.html'
        report = XTestRunner.HTMLTestRunner(open(html_file, 'wb'), title='UI测试报告', description='请查收！')
        return report
    def mail(self):
        t = time.strftime('%Y%m%d%H%M%S', time.localtime())
        attachments = glob.glob(rf'D:\zhuangaoliu\gaowei611zk_UI\Report\*.html')
        mail = yagmail.SMTP(user='2318636512@qq.com', password='lmakcmojpqpjdhhj', host='smtp.qq.com')
        mail.send(to='2318636512@qq.com', contents='这是关于管理活动的测试报告', attachments=attachments)
        mail.close()






